﻿namespace AutoRevit.Ribbon.Ribbon.Mapper;

/// <summary>
/// Tab映射器
/// </summary>
public class TabMapper : ControlItemMapperBase
{
    /// <summary>
    /// Tab映射器
    /// </summary>
    /// <param name="name"></param>
    public TabMapper(string name)
    {
        Name = name;
    }

    /// <summary>
    /// 实际已生成的控件
    /// </summary>
    public RibbonTab? Control { get; internal set; }

    /// <summary>
    /// 获取当前TabMapper下的PanelMapper
    /// </summary>
    /// <param name="panelName"></param>
    /// <returns></returns>
    public PanelMapper? this[string panelName]
    {
        get
        {
            return Panels.FirstOrDefault(t => t.Name == panelName);
        }
    }

    /// <summary>
    /// Tab映射器
    /// </summary>
    public List<PanelMapper> Panels { get; set; } = [];
}
